home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / hacker9.txt < prev    next >
Text File  |  1995-03-31  |  18KB  |  506 lines

  1. DOC 1.1 -- HACKER directory documentation 
  2. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 
  3. NOTE!  This is a plain ASCII text file containing multiple 
  4. documents. You may find it most convenient to view or print this file 
  5. by running the DOC.EXE program (supplied on this disk) on your PC. 
  6. This is the first Goodies Disk to do it this way.  Hope you like it. 
  7. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 
  8. :GD9 
  9. :Hacker's Goodies 
  10. :-jkh- 
  11.  
  12. @@Access Ptrs 
  13. Article about "access pointers", the new G/GX object type. 
  14. By Joe Horn. 
  15.  
  16. jsw@well.sf.ca.us [James Weisbin] writes: 
  17.  
  18. > If you execute 2 RPORT (from R Hellsterns <-LIB-> 
  19. > splitter) on a GX, you get a bunch (well, one for each 
  20. > library object in that port) of ACPTR objects on the 
  21. > stack. Exactly what are these, and is there a way to 
  22. > convert them to their respective library objects (if 
  23. > that's what they represent)? Any help would be 
  24. > appreciated. 
  25.  
  26. ***  THE FOLLOWING IS NOT MANUFACTURER SUPPORTED  *** 
  27.  
  28. The SX had four "undefined" object types reserved for 
  29. future use: 
  30.  
  31. ÉííííííííÑííííííííííÑííííííííííÑíííííííííííííííííííííí» 
  32. º Header 3 Old Name 3 New Name 3 Internal object type º 
  33. ÇÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 
  34. º 02BAA  3  EXT1    3  ACPTR   3  BF                  º 
  35. º 02BCC  3  EXT2    3  EXT2    3  CF                  º 
  36. º 02BEE  3  EXT3    3  EXT3    3  DF                  º 
  37. º 02C10  3  EXT4    3  EXT4    3  EF                  º 
  38. èííííííííïííííííííííïííííííííííïíííííííííííííííííííííí¼ 
  39.  
  40. The GX has taken one of these unused object types and 
  41. defined it. The old EXT1 has now become ACPTR, "access 
  42. pointer". ACPTR objects are pointers to library objects 
  43. in ports 2 and above. It's part of the GX's complicated 
  44. bank-switching scheme. 
  45.  
  46. Perform an ->ASCI on one of these objects, and you'll see 
  47. that it's of this form: 
  48.  
  49.      AAB20 ppppp jjjjj 
  50.  
  51. where AAB20 is the prolog (backwards), ppppp is the 
  52. address of the library, and jjjjj is the address that the 
  53. HP48 jumps to (a machine language jump, not an RPL jump!) 
  54. to evaluate that object. If you use Voyager to 
  55. disassemble the code at jjjjj, you'll see how the jump 
  56. table works on different bank-switching situations. 
  57.  
  58. All the hackers' writings since 6 March 1990 have assumed 
  59. that "external objects" would have a length field after 
  60. the prolog, like strings and many other objects do. HP's 
  61. documentation, however, does not say this anywhere, and 
  62. sure enough, ACPTR's do NOT have a length field. This 
  63. causes every "unthreader" that I know of (other than 
  64. <-RPL-> ) to start mistracking when they hit an ACPTR. If 
  65. you have any software that handles HP48 objects, be sure 
  66. to take into account the new fact that ACPTR's are always 
  67. 7.5 bytes long. 
  68.  
  69. Note well: Since EXT1 is no longer undefined, DON'T USE 
  70. IT in your own programs!!  Software that did use EXT1 
  71. ought to be rewritten. Commercial software ought not use 
  72. any of these "reserved" object types at all, since they 
  73. may be used by a future machine or library. 
  74.  
  75. The "Michigan Virus" uses EXT2, and is therefore just as 
  76. able to infect the G series as any other HP48. 
  77.  
  78. @@BREAKLIB   S- 
  79. BREAKLIB, a fast Library Breaker. By ?? 
  80. Documentation by Joe Horn. 
  81.  
  82. CAUTION: DOES *NOT* WORK ON THE HP48 G/GX. 
  83.  
  84. Type the ID number of any attached library (other than 
  85. 1041), and press EXE. A directory will be created 
  86. containing that library's contents in directory form. 
  87. Although this is the same idea as the L->DIR command in 
  88. the <-LIB-> library on Goodies Disk #8, BREAKLIB is much 
  89. faster. 
  90.  
  91. Press INFOS for a nifty info screen; press any key to 
  92. page down. 
  93.  
  94. Do not use BREAKLIB on itself. Use L->DIR on it instead. 
  95.  
  96. -Joseph K. Horn-   EQU   akcs.joehorn@hpcvbbs.cv.hp.com 
  97.  
  98. @@CHKRX      SG 
  99. (Comp.sys.hp48) 
  100. Item: 1862 by pshuprs@prism.gatech.EDU [Howlin' Bob] 
  101. Subj: Syseval to check rx pin state 
  102. Date: 11 Oct 1992 
  103.  
  104. [This whole post is about reading the RX pin on the 
  105.  HP48's serial port. If you don't care, then skip it. 
  106.  It's a long one.] 
  107.  
  108. akcs.n2kyw@hpcvbbs.cv.hp.com (Paul Smith) writes: 
  109.  
  110.    Is there a simple syseval or other way to check the 
  111.    state of the serial port's receive pin from a program? 
  112.    I want to avoid any ml type overhead stuff, so a 
  113.    single syseval would be ideal. 
  114.  
  115.    Thanks 
  116.    Paul Smith 
  117.    smit3223@nova.gmi.edu 
  118.  
  119. First of all, there are two VERY important locations for 
  120. doing this. No, first of all, I need to thank Joe Ervin 
  121. for the information I used to do this. This entire post 
  122. is basically a paraphrasing of his work. Thanks. 
  123.  
  124. Second are the V.I.A.'s (very imp. addresses) 
  125.  
  126.  0x110  (110 hexadecimal)  is  the UART control register 
  127.  
  128.  0x111                     is the serial receive 
  129.                            control/status 
  130.  
  131. They are nibble-long memory-mapped IO registers. When 
  132. you twiddle these, you're twiddling hardware. 
  133.  
  134. UART_CONTROL at 0x110: 
  135.  
  136.     [SON ETBE ERBF ERBZ] 
  137. msb . . . . . . . . . . least significant bit. 
  138.  
  139.    SON=Serial ON. Set it to allow the UART to work. The 
  140.        rest are interrupt control registers explained in 
  141.        the source code comments. 
  142.  
  143. SERIAL_STATUS at 0x111:  [RX RER RBZ RBF] 
  144.     
  145.    RX corresponds to the state of the receive (RX) line 
  146.       (read only - you can hardly change someone else's 
  147.       TX by writing here). The rest are explained in the 
  148.       source code comments. 
  149.  
  150. To read the state of the RX pin, simply set bit 3 of the 
  151. UART_CONTROL register and then read bit 3 of the 
  152. SERIAL_STATUS register. very simple. 
  153.  
  154. This sort of thing is all but useless for real serial IO, 
  155. as you'd have to do all sort of timing, jamming bits 
  156. together in a makeshift shift register, etc. That's what 
  157. the hardware boys are for (and, of course, the UART - 
  158. Universal Asynchronous Rabbit Tamer...sorry I forgot the 
  159. last two letters. [Receiver/Transmitter. -jkh-] 
  160. Basically, a serial line->Byte device) 
  161.  
  162. A program follows which does some neat stuff for 
  163. monitoring the RX pin The poster (Paul) who asked about 
  164. this plans on using the RX pin for morse code 
  165. applications. This would be simple. Sort of. I guess 
  166. you'd have to debounce. 
  167.  
  168. The source code for it is included. I wrote this using 
  169. the HP tools, and in HP mnemonics. They're really kind of 
  170. aesthetic once you're accustomed to them. 
  171.  
  172. [It's called chkrx.s on this disk. -jkh-] 
  173.  
  174. The loader control file is included too. 
  175.  
  176. [It's called chkrx.m on this disk. -jkh-] 
  177.  
  178. Follow the standard procecure for compiling. 
  179.  
  180. [Only if you really enjoy doing so, but you don't have 
  181.  to; it's already been compiled and is called chkrx on 
  182.  this disk. -jkh-] 
  183.  
  184. I hope this helps someone! 
  185.  
  186.  
  187. Robert 
  188.  
  189. --  
  190. Robert Sanders  
  191. Georgia Institute of Technology 
  192. Internet: pshuprs@prism.gatech.edu 
  193.       OR  gt8134b@prism.gatech.edu 
  194.  
  195. @@CloneMe    SG 
  196. From: tedb@hpcvra.cv.hp.com. (Ted Beers) 
  197. Newsgroups: comp.sys.hp48 
  198. Subject: HP 48 Program Procreation 
  199. Date: 23 Aug 91 22:06:57 GMT 
  200. Organization: Hewlett-Packard Co., Corvallis, OR, USA 
  201.  
  202.  
  203.     I was intrigued by a challenge made by Ken Thompson 
  204.     (coauthor of Unix) many years ago and mentioned again 
  205.     in the September, 1991, issue of Dr. Dobb's Journal. 
  206.     To paraphrase, as a test of a computer language's 
  207.     power, Thompson suggested that one write a program 
  208.     that, when compiled and executed, will produce an 
  209.     exact copy of itself. Taking up the gauntlet, here's 
  210.     what I came up with for the HP 48: 
  211.  
  212.       Warning!  Examining this program too closely can 
  213.       prove hazardous to your sanity. 
  214.  
  215. @ CloneMe:  A program that creates itself. 
  216. @ Reference: Dr. Dobb's Journal #180, September, 1991, 
  217. @ pg. 18. 
  218. @ Problem first proposed by Ken Thompson. 
  219. \<< 
  220.   C$ 31 "\<< C$ 31 " OVER + SWAP + STR\-> \>> 
  221.   "\<< C$ 31 " OVER + SWAP + STR\-> 
  222. \>> 
  223.  
  224.     (Note: C$ <n> is a little-known built-in object 
  225.     delimiter for an <n>-character string.) 
  226.  
  227.     When this program is executed, it will output itself! 
  228.  
  229.     At first this exercise might seem either trivial or 
  230.     impossible, but it's neither. The trick at work here 
  231.     is to make the first half of the program create a 
  232.     string that represents the second half of the 
  233.     program, and to make the second half of the program 
  234.     put together the first half of the program with the 
  235.     second half and change the result into a program 
  236.     (whew!). 
  237.  
  238.     Variations are possible. Here's a program that 
  239.     creates TWO copies of itself, changing the motive 
  240.     from procreation to proliferation: 
  241.  
  242. \<< 
  243.   C$ 35 "\<< C$ 35 " OVER + SWAP + STR\-> DUP \>> 
  244.   "\<< C$ 35 " OVER + SWAP + STR\-> DUP 
  245. \>> 
  246.  
  247.     And then of course there's the suicidal variation 
  248.     who's sole purpose is to disappear: 
  249.  
  250. \<< \>> 
  251.  
  252.     Can anyone create a shorter version of the program 
  253.     that creates itself?  (Removing unnecessary but 
  254.     friendly formatting doesn't count!) 
  255.  
  256.                                 Ted W. Beers 
  257.                                 Hewlett-Packard 
  258.  
  259. @@CloneMe2   SG 
  260. By: John Paul Morrison 
  261. From: ochealth@unixg.ubc.ca (Occupational Health and 
  262.       Safety) 
  263. Newsgroups: comp.sys.hp48 
  264. Subject: HP 48 Program Procreation 
  265. Date: 26 Aug 91 16:22:58 GMT 
  266. Organization: University of British Columbia, Vancouver, 
  267.               B.C., Canada 
  268.  
  269. How's this for short: 
  270.  
  271. \<< LASTARG \>> 
  272.  
  273. :-) 
  274.  
  275. Of course, you need to assume the calculator has the 
  276. right flags set! [Namely, flag -55 must be clear, which 
  277. is the default state. -jkh-] 
  278.  
  279. John Paul Morrison 
  280.  
  281. @@DUMP       SG 
  282. (Comp.sys.hp48) 
  283. Item: 1616 by ftg0673@tamsun.tamu.edu [Rick Grevelle] 
  284. Subj: Memory Dump 
  285. Date: 22 Aug 1993 
  286.  
  287. Those hard core 48 users who are interested in reverse 
  288. engineering Hewlett-Packard's latest efforts might have a 
  289. use for this. It's a little scheme that's actually part 
  290. of a machine language library I'm developing which is 
  291. nearing completion at this time. The big package will 
  292. contain a variety professional quality tools that are 
  293. intended to complement those utilities already available. 
  294. I have designed this product to benefit everyone from the 
  295. beginner to the very experienced user. The software runs 
  296. in all 48 revisions and is quite quick, especially so in 
  297. the GX revisions since the faster CPU was added. These 
  298. routines begin beyond where HACKIT left off and 
  299. essentially provide a set of practical tools for every 
  300. day use which may become habit forming. Among my 
  301. favorite is the library builder and the full-screen 
  302. memory scanner which of course are all machine-language. 
  303. The routine here is a modified revision of the 
  304. memory-dump scheme which is utilized by the memory 
  305. scanner, and is used to dump the contents in memory of a 
  306. specified address in the 48. The scheme here 
  307. automatically dumps the 256k unpaged ROM that begins at 
  308. #0h and ends at #7FFFFh. The dump which it produces is 
  309. usable by a variety of tools which includes Derek 
  310. Nickel's Voyager and Jan Brittenson's SAD. After down 
  311. loading the DUMP routine to either an SX or a GX, a dump 
  312. may be accomplished by the following: 
  313.  
  314.   o  Type kermit at the prompt of a machine in which 
  315.      KERMIT has been installed. 
  316.  
  317.   o  Set the BAUD rate to 9600 by typing at the kermit 
  318.      prompt 'set baud 9600'. 
  319.  
  320.   o  Capture the dump in a file by typing at the kermit 
  321.      prompt 'log session <file>'. 
  322.  
  323.   o  Connect the serial port by typing at the kermit 
  324.      prompt 'connect'. 
  325.  
  326.   o  Invoke DUMP to start the memory dump. 
  327.  
  328.  
  329. Once invoked, DUMP will continue until the entire 256k 
  330. bytes dumps to the receiving end. Due to the faster CPU 
  331. of the GX, it's very possible that some machines might 
  332. experience 'buffer overflow' in which case characters 
  333. will be missed. Faster machines such as the 386's and 
  334. 486's shouldn't have a problem though. For complete 
  335. details I've included the source code here which should 
  336. help anyone who might have special needs or a desire to 
  337. modify the performance of the routine. All in all 
  338. there's no magic here, but the larger package of which 
  339. this material is a part is entirely another story. 
  340.  
  341. Rick Grevelle 
  342. (409) 774-1169 
  343. ftg0673@tamsun.tamu.edu 
  344.  
  345.  
  346.          TITLE 256k I/O ASCII Memory Dump, Version 1.1 
  347. ** begin DUMP.S ***************************************** 
  348. ********************************************************* 
  349. ** 
  350. ** NAME: DUMP 
  351. ** 
  352. ** CATEGORY: Memory 
  353. ** 
  354. ** ENTRY: - 
  355. ** 
  356. ** EXIT: - 
  357. **                     
  358. ** CALLS: SAVPTR, init_UART*, OUTUART, GETPTRLOOP. 
  359. ** 
  360. ** STACK LEVELS: 2 
  361. ** 
  362. ** ABSTRACT: Dumps first 256k bytes of memory (ROM). 
  363. ** 
  364. ** MODULE HISTORY: 
  365. ** 
  366. ** Written               08/12/93        Rick Grevelle 
  367. ** 
  368. ********************************************************* 
  369. ********************************************************* 
  370. ASSEMBLE 
  371. =init_UART*      EQU     #30EBC 
  372. RPL 
  373. CODE 
  374.          GOSBVL  =SAVPTR 
  375.  
  376. ** Zero cpu registers. 
  377.          P=      0 
  378.          A=0     W 
  379.          B=0     W 
  380.          C=0     W 
  381.          D=0     W 
  382.          R0=A    W 
  383.          R1=A    W 
  384.  
  385. ** Initialize dump parameters. 
  386.          LC(1)   6                       9600 BAUD 
  387.          GOSBVL  =init_UART* 
  388.          LC(5)   (256*1024*2/16)-1       256k bytes 
  389.  
  390. ** Main transmit loop. 
  391. iodmplp  RSTK=C 
  392.  
  393. ** Initilize memory pointer loop. 
  394.          A=R0.F  A 
  395.          ASRC 
  396.          ASRC 
  397.          ASRC 
  398.          ASRC 
  399.          ASRC 
  400.          R1=A.F  W 
  401.          P=      0 
  402.          LC(5)   4 
  403.  
  404. ** Transmit the 5 nibble address in memory. 
  405. ioptrlp  RSTK=C  A        ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ 
  406.          A=R1.F  W                                  
  407.          A=0     B                                3 
  408.          ASLC                                     3 
  409.          R1=A.F  W                                3 
  410. ** Compute ASCII translation one byte at a time.  3 
  411.          LCASC   \0\                              3 
  412.          A=A+C   B                                3 
  413.          LCASC   \9\                              3 
  414.          ?C>=A   B                                3 
  415.          GOYES   xmitptr                          3 
  416.          LC(2)   7                                3 
  417.          A=A+C   B                                3 
  418. ** Transmit pointer character.                    3 
  419. xmitptr  GOSBVL  =OUTUART                         3 
  420.          C=RSTK  A                                3 
  421.          C=C-1   A                                3 
  422.          GONC    ioptrlp ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ù 
  423.  
  424. ** Transmit colon. 
  425.          LCASC   \:\ 
  426.          A=C     B 
  427.          GOSBVL  =OUTUART 
  428.  
  429. ** Initilize memory loop. 
  430.          P=      0 
  431.          LC(5)   15 
  432.  
  433. ** Transmit 16 nibbles of memory @D0. 
  434. iomemlp  RSTK=C  A        ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ 
  435.          A=R0.F  A                                  
  436.          D1=A                                     3 
  437.          A=A+1   A                                3 
  438.          R0=A.F  A                                3 
  439.          A=0     B                                3 
  440.          A=DAT1  1                                3 
  441. ** Compute ASCII translation one byte at a time.  3 
  442.          LCASC   \0\                              3 
  443.          A=A+C   B                                3 
  444.          LCASC   \9\                              3 
  445.          ?C>=A   B                                3 
  446.          GOYES   xmitmem                          3 
  447.          LC(2)   7                                3 
  448.          A=A+C   B                                3 
  449. ** Transmit memory character.                     3 
  450. xmitmem  GOSBVL  =OUTUART                         3 
  451.          C=RSTK  A                                3 
  452.          C=C-1   A                                3 
  453.          GONC    iomemlp ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ù 
  454.  
  455. ** Transmit CR. 
  456.          LC(2)   13 
  457.          A=C     B 
  458.          GOSBVL  =OUTUART 
  459.  
  460. ** Transmit LF. 
  461.          LC(2)   10 
  462.          A=C     B 
  463.          GOSBVL  =OUTUART 
  464.          C=RSTK 
  465.          C=C-1   A 
  466.          GOC     getptrloop 
  467.          GOTO    iodmplp 
  468.  
  469. getptrloop 
  470.          GOVLNG  =GETPTRLOOP 
  471. ENDCODE 
  472. @@LIBMAKER   S- 
  473. LIBMAKER, a Library Builder. By ?? 
  474.  
  475. [S/SX only!  Clears memory on the G/GX.  -jkh-] 
  476.  
  477. Turns directories into libraries. Similar to the D->LIB 
  478. command in the <-LIB-> library on Goodies Disk #8; see 
  479. that for more details. 
  480.  
  481. @@MLDL 1.06  S- 
  482. Version 1.06 of Jan Brittenson's awesome Machine Language 
  483. Development Library is in the HACKER directory on this 
  484. disk. Its documentation is so huge that it has its own 
  485. documentation file. Press ESC S M M ENTER to view and/or 
  486. print its documentation. 
  487.  
  488. @@Rosetta 
  489. The HP48 Rosetta Stone 
  490. by Joe Horn & Jan Brittenson 
  491.  
  492. The HP <--> AG Mnemonics Translation Table 
  493.  
  494. There are two different sets of mnemonics in use for the 
  495. HP48's assembly language; the set used by HP to develop 
  496. their calculators' operating systems and support 
  497. software, and the set invented by Alonzo Gariepy in an 
  498. attempt to make assembly language more understandable. 
  499. People keep clamoring for a HP-to-AG dictionary. So we 
  500. made one. 
  501.  
  502. It's called ROSETTA.DOC, and can be found in the HACKER 
  503. directory on this disk. Use LIST.COM to view and/or 
  504. print it. 
  505.